#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {
    int seed = 1000;
    int numPlayer = 2;
    int cp, r, handCount;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;
    int maxHandCount = 5;
	int loopCnt = 10; //how many loops I want to test this over and over
	int trashflag, handPos;
	trashflag = 1;
	int i;
	cp = 1;

#if (NOISY_TEST == 1)
    printf ("TESTING discardCard():\n");
#endif
	

	for(i=0; i<loopCnt; i++) {
  
        for (handCount = 1; handCount <= maxHandCount; handCount++)
        {
			handPos = handCount - 1;

			memset(&G, 23, sizeof(struct gameState));   // clear the game state
			r = initializeGame(numPlayer, k, seed, &G); // initialize a new game
			G.handCount[cp] = handCount;                 // set the number of cards on hand
               
			discardCard(handPos, cp, &G, trashflag);

			#if (NOISY_TEST == 1)
                printf("G.handCount = %d, expected = %d\n", G.handCount[cp], handCount - 1);
			#endif

                assert(G.handCount[cp] == (handCount - 1)); // check if the handCount is correct
        }
 
}
    printf("All tests passed!\n");

    return 0;
}
